
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.JavaScript · 邦德前端开发</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        <meta name="author" content="i@ickeep.com">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-diy-introduction/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="4.ESlint检测规则说明.html" />
    
    
    <link rel="prev" href="2.CSS.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://2017hcb.bond520.com/pc/index.html" target="_blank" class="custom-link">邦德官网</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        <li class="header">开发说明</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">前端规范</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="1.HTML.html">
            
                <a href="1.HTML.html">
            
                    
                    1.HTML
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="2.CSS.html">
            
                <a href="2.CSS.html">
            
                    
                    2.CSS
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.3" data-path="3.JavaScript.html">
            
                <a href="3.JavaScript.html">
            
                    
                    3.JavaScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="4.ESlint检测规则说明.html">
            
                <a href="4.ESlint检测规则说明.html">
            
                    
                    4.ESlint 检测规则说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="5.vue规范.html">
            
                <a href="5.vue规范.html">
            
                    
                    5.vue规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="6.前后端数据交互说明.html">
            
                <a href="6.前后端数据交互说明.html">
            
                    
                    6.前后端数据交互说明
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">常见问题</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../3.常见问题/常见问题.html">
            
                <a href="../3.常见问题/常见问题.html">
            
                    
                    常见问题
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >3.JavaScript</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="javascript-&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x89C4;&#x8303;"><a name="javascript-&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x89C4;&#x8303;" class="plugin-anchor" href="#javascript-&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x89C4;&#x8303;"><i class="fa fa-link" aria-hidden="true"></i></a>javascript &#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x89C4;&#x8303;</h1>
<blockquote>
<p>&#x4E3B;&#x8981;&#x53C2;&#x8003; <a href="https://github.com/fex-team/styleguide/blob/master/javascript.md" target="_blank">&#x767E;&#x5EA6; FEX-team &#x89C4;&#x8303;</a> </p>
</blockquote>
<h2 id="1-&#x4EE3;&#x7801;&#x98CE;&#x683C;"><a name="1-&#x4EE3;&#x7801;&#x98CE;&#x683C;" class="plugin-anchor" href="#1-&#x4EE3;&#x7801;&#x98CE;&#x683C;"><i class="fa fa-link" aria-hidden="true"></i></a>1 &#x4EE3;&#x7801;&#x98CE;&#x683C;</h2>
<ol>
<li><code>JavaScript</code> &#x6587;&#x4EF6;&#x4F7F;&#x7528;&#x65E0; <code>BOM</code> &#x7684; <code>UTF-8</code> &#x7F16;&#x7801;&#x3002;<blockquote>
<p>UTF-8 &#x7F16;&#x7801;&#x5177;&#x6709;&#x66F4;&#x5E7F;&#x6CDB;&#x7684;&#x9002;&#x5E94;&#x6027;&#x3002;BOM &#x5728;&#x4F7F;&#x7528;&#x7A0B;&#x5E8F;&#x6216;&#x5DE5;&#x5177;&#x5904;&#x7406;&#x6587;&#x4EF6;&#x65F6;&#x53EF;&#x80FD;&#x9020;&#x6210;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x5E72;&#x6270;&#x3002;</p>
</blockquote>
</li>
<li>&#x5728;&#x6587;&#x4EF6;&#x7ED3;&#x5C3E;&#x5904;&#xFF0C;&#x4FDD;&#x7559;&#x4E00;&#x4E2A;&#x7A7A;&#x884C;&#x3002;</li>
<li>&#x4F7F;&#x7528; <code>2</code> &#x4E2A;&#x7A7A;&#x683C;&#x505A;&#x4E3A;&#x4E00;&#x4E2A;&#x7F29;&#x8FDB;&#x5C42;&#x7EA7;</li>
<li>&#x6BCF;&#x4E2A;&#x72EC;&#x7ACB;&#x8BED;&#x53E5;&#x7ED3;&#x675F;&#x540E;&#x5FC5;&#x987B;&#x6362;&#x884C;&#x3002;</li>
<li>&#x6BCF;&#x884C;&#x4E0D;&#x5F97;&#x8D85;&#x8FC7; <code>180</code> &#x4E2A;&#x5B57;&#x7B26;&#x3002;<blockquote>
<p>&#x8D85;&#x957F;&#x7684;&#x4E0D;&#x53EF;&#x5206;&#x5272;&#x7684;&#x4EE3;&#x7801;&#x5141;&#x8BB8;&#x4F8B;&#x5916;&#xFF0C;&#x6BD4;&#x5982;&#x590D;&#x6742;&#x7684;&#x6B63;&#x5219;&#x8868;&#x8FBE;&#x5F0F;&#x3002;&#x957F;&#x5B57;&#x7B26;&#x4E32;&#x4E0D;&#x5728;&#x4F8B;&#x5916;&#x4E4B;&#x5217;&#x3002;</p>
</blockquote>
</li>
<li><p>&#x8FD0;&#x7B97;&#x7B26;&#x5904;&#x6362;&#x884C;&#x65F6;&#xFF0C;&#x8FD0;&#x7B97;&#x7B26;&#x5FC5;&#x987B;&#x5728;&#x65B0;&#x884C;&#x7684;&#x884C;&#x9996;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token comment" spellcheck="true">// good</span>
 <span class="token keyword">if</span> <span class="token punctuation">(</span>user<span class="token punctuation">.</span><span class="token function">isAuthenticated</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
     <span class="token operator">&amp;&amp;</span> user<span class="token punctuation">.</span><span class="token function">isInRole</span><span class="token punctuation">(</span><span class="token string">&apos;admin&apos;</span><span class="token punctuation">)</span>
     <span class="token operator">&amp;&amp;</span> user<span class="token punctuation">.</span><span class="token function">hasAuthority</span><span class="token punctuation">(</span><span class="token string">&apos;add-admin&apos;</span><span class="token punctuation">)</span>
     <span class="token operator">||</span> user<span class="token punctuation">.</span><span class="token function">hasAuthority</span><span class="token punctuation">(</span><span class="token string">&apos;delete-admin&apos;</span><span class="token punctuation">)</span>
 <span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
<li>&#x80FD;&#x7701;&#x7565;&#x8BED;&#x53E5;&#x7ED3;&#x675F;&#x7684;&#x5206;&#x53F7;&#x7684;&#x5C3D;&#x91CF;&#x7701;&#x7565;</li>
</ol>
<h2 id="2-&#x547D;&#x540D;"><a name="2-&#x547D;&#x540D;" class="plugin-anchor" href="#2-&#x547D;&#x540D;"><i class="fa fa-link" aria-hidden="true"></i></a>2 &#x547D;&#x540D;</h2>
<ol>
<li><p><code>&#x53D8;&#x91CF;</code> &#x4F7F;&#x7528; <code>Camel&#x547D;&#x540D;&#x6CD5;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token keyword">var</span> loadingModules <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p><code>&#x5E38;&#x91CF;</code> &#x4F7F;&#x7528; <code>&#x5168;&#x90E8;&#x5B57;&#x6BCD;&#x5927;&#x5199;&#xFF0C;&#x5355;&#x8BCD;&#x95F4;&#x4E0B;&#x5212;&#x7EBF;&#x5206;&#x9694;</code> &#x7684;&#x547D;&#x540D;&#x65B9;&#x5F0F;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token keyword">const</span> HTML_ENTITY <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p><code>&#x51FD;&#x6570;</code> &#x4F7F;&#x7528; <code>Camel&#x547D;&#x540D;&#x6CD5;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token keyword">function</span> <span class="token function">stringFormat</span><span class="token punctuation">(</span>source<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
<li><p>&#x51FD;&#x6570;&#x7684; <code>&#x53C2;&#x6570;</code> &#x4F7F;&#x7528; <code>Camel&#x547D;&#x540D;&#x6CD5;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript">  <span class="token keyword">function</span> <span class="token function">hear</span><span class="token punctuation">(</span>theBells<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
</ol>
<ol>
<li><p><code>&#x7C7B;</code> &#x4F7F;&#x7528; <code>Pascal&#x547D;&#x540D;&#x6CD5;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript">      <span class="token keyword">function</span> <span class="token function">TextNode</span><span class="token punctuation">(</span>options<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
<li><p>&#x7C7B;&#x7684; <code>&#x65B9;&#x6CD5; / &#x5C5E;&#x6027;</code> &#x4F7F;&#x7528; <code>Camel&#x547D;&#x540D;&#x6CD5;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token keyword">function</span> <span class="token function">TextNode</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> engine<span class="token punctuation">)</span> <span class="token punctuation">{</span>
     <span class="token keyword">this</span><span class="token punctuation">.</span>value <span class="token operator">=</span> value<span class="token punctuation">;</span>
     <span class="token keyword">this</span><span class="token punctuation">.</span>engine <span class="token operator">=</span> engine<span class="token punctuation">;</span>
 <span class="token punctuation">}</span>

 TextNode<span class="token punctuation">.</span>prototype<span class="token punctuation">.</span>clone <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
     <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">;</span>
 <span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p><code>&#x679A;&#x4E3E;&#x53D8;&#x91CF;</code> &#x4F7F;&#x7528; <code>Pascal&#x547D;&#x540D;&#x6CD5;</code>&#xFF0C;<code>&#x679A;&#x4E3E;&#x7684;&#x5C5E;&#x6027;</code> &#x4F7F;&#x7528; <code>&#x5168;&#x90E8;&#x5B57;&#x6BCD;&#x5927;&#x5199;&#xFF0C;&#x5355;&#x8BCD;&#x95F4;&#x4E0B;&#x5212;&#x7EBF;&#x5206;&#x9694;</code> &#x7684;&#x547D;&#x540D;&#x65B9;&#x5F0F;&#x3002;</p>
<pre class="language-"><code class="lang-javascript">    <span class="token keyword">const</span> TargetState <span class="token operator">=</span> <span class="token punctuation">{</span>
        READING<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
        READED<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
        APPLIED<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
        READY<span class="token punctuation">:</span> <span class="token number">4</span>
    <span class="token punctuation">}</span>
</code></pre>
</li>
<li><p><code>&#x547D;&#x540D;&#x7A7A;&#x95F4;</code> &#x4F7F;&#x7528; <code>Camel&#x547D;&#x540D;&#x6CD5;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript">   equipments<span class="token punctuation">.</span>heavyWeapons <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p>&#x7531;&#x591A;&#x4E2A;&#x5355;&#x8BCD;&#x7EC4;&#x6210;&#x7684;&#x7F29;&#x5199;&#x8BCD;&#xFF0C;&#x5728;&#x547D;&#x540D;&#x4E2D;&#xFF0C;&#x6839;&#x636E;&#x5F53;&#x524D;&#x547D;&#x540D;&#x6CD5;&#x548C;&#x51FA;&#x73B0;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x6240;&#x6709;&#x5B57;&#x6BCD;&#x7684;&#x5927;&#x5C0F;&#x5199;&#x4E0E;&#x9996;&#x5B57;&#x6BCD;&#x7684;&#x5927;&#x5C0F;&#x5199;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token keyword">function</span> <span class="token function">XMLParser</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>

 <span class="token keyword">function</span> <span class="token function">insertHTML</span><span class="token punctuation">(</span>element<span class="token punctuation">,</span> html<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>

 <span class="token keyword">const</span> httpRequest <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HTTPRequest</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p><code>&#x7C7B;&#x540D;</code> &#x4F7F;&#x7528; <code>&#x540D;&#x8BCD;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">function</span> <span class="token function">Engine</span><span class="token punctuation">(</span>options<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
<li><p><code>&#x51FD;&#x6570;&#x540D;</code> &#x4F7F;&#x7528; <code>&#x52A8;&#x5BBE;&#x77ED;&#x8BED;</code>&#x3002;</p>
<pre class="language-"><code class="lang-javascript">  <span class="token keyword">function</span> <span class="token function">getStyle</span><span class="token punctuation">(</span>element<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
<li><p><code>boolean</code> &#x7C7B;&#x578B;&#x7684;&#x53D8;&#x91CF;&#x4F7F;&#x7528; <code>is</code> &#x6216; <code>has</code> &#x5F00;&#x5934;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">let</span> isReady <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
<span class="token keyword">let</span> hasMoreCommands <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p><code>Promise&#x5BF9;&#x8C61;</code> &#x7528; <code>&#x52A8;&#x5BBE;&#x77ED;&#x8BED;&#x7684;&#x8FDB;&#x884C;&#x65F6;</code> &#x8868;&#x8FBE;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token keyword">let</span> loadingData <span class="token operator">=</span> ajax<span class="token punctuation">.</span><span class="token keyword">get</span><span class="token punctuation">(</span><span class="token string">&apos;url&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
loadingData<span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span>callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
</li>
</ol>
<h2 id="3-&#x6CE8;&#x91CA;"><a name="3-&#x6CE8;&#x91CA;" class="plugin-anchor" href="#3-&#x6CE8;&#x91CA;"><i class="fa fa-link" aria-hidden="true"></i></a>3 &#x6CE8;&#x91CA;</h2>
<ol>
<li>&#x5355;&#x884C;&#x6CE8;&#x91CA; &#x5FC5;&#x987B;&#x72EC;&#x5360;&#x4E00;&#x884C;&#x3002;<code>//</code> &#x540E;&#x8DDF;&#x4E00;&#x4E2A;&#x7A7A;&#x683C;&#xFF0C;&#x7F29;&#x8FDB;&#x4E0E;&#x4E0B;&#x4E00;&#x884C;&#x88AB;&#x6CE8;&#x91CA;&#x8BF4;&#x660E;&#x7684;&#x4EE3;&#x7801;&#x4E00;&#x81F4;&#x3002;</li>
<li>&#x591A;&#x884C;&#x6CE8;&#x91CA; &#x907F;&#x514D;&#x4F7F;&#x7528; <code>/*...*/</code> &#x8FD9;&#x6837;&#x7684;&#x591A;&#x884C;&#x6CE8;&#x91CA;&#x3002;&#x6709;&#x591A;&#x884C;&#x6CE8;&#x91CA;&#x5185;&#x5BB9;&#x65F6;&#xFF0C;&#x4F7F;&#x7528;&#x591A;&#x4E2A;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#x3002;</li>
<li><p>&#x6587;&#x6863;&#x5316;&#x6CE8;&#x91CA; &#x4E3A;&#x4E86;&#x4FBF;&#x4E8E;&#x4EE3;&#x7801;&#x9605;&#x8BFB;&#x548C;&#x81EA;&#x6587;&#x6863;&#x5316;&#xFF0C;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#x5FC5;&#x987B;&#x5305;&#x542B;&#x4EE5; <code>/**...*/</code> &#x5F62;&#x5F0F;&#x7684;&#x5757;&#x6CE8;&#x91CA;&#x4E2D;&#x3002;</p>
<pre class="language-"><code> &#x89E3;&#x91CA;&#xFF1A; 
 1. &#x6587;&#x4EF6;
 2. namespace
 3. &#x7C7B;
 4. &#x51FD;&#x6570;&#x6216;&#x65B9;&#x6CD5;
 5. &#x7C7B;&#x5C5E;&#x6027;
 6. &#x4E8B;&#x4EF6;
 7. &#x5168;&#x5C40;&#x53D8;&#x91CF;
 8. &#x5E38;&#x91CF;
</code></pre></li>
<li><p>&#x6587;&#x6863;&#x6CE8;&#x91CA;&#x524D;&#x5FC5;&#x987B;&#x7A7A;&#x4E00;&#x884C;&#x3002;</p>
</li>
<li>&#x81EA;&#x6587;&#x6863;&#x5316;&#x7684;&#x6587;&#x6863;&#x8BF4;&#x660E; what&#xFF0C;&#x800C;&#x4E0D;&#x662F; how&#x3002;</li>
<li>&#x7C7B;&#x578B;&#x5B9A;&#x4E49;&#x90FD;&#x662F;&#x4EE5;<code>{</code>&#x5F00;&#x59CB;, &#x4EE5;<code>}</code>&#x7ED3;&#x675F;&#x3002;<blockquote>
<p> &#x5E38;&#x7528;&#x7C7B;&#x578B;&#x5982;&#xFF1A;{string}, {number}, {boolean}, {Object}, {Function}, {RegExp}, {Array}, {Date}&#x3002;
 &#x7C7B;&#x578B;&#x4E0D;&#x4EC5;&#x5C40;&#x9650;&#x4E8E;&#x5185;&#x7F6E;&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x81EA;&#x5B9A;&#x4E49;&#x7684;&#x7C7B;&#x578B;&#x3002;&#x6BD4;&#x5982;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x7C7B; Developer&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5B83;&#x6765;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x548C;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x7C7B;&#x578B;&#x3002;</p>
</blockquote>
</li>
<li>&#x5BF9;&#x4E8E;&#x57FA;&#x672C;&#x7C7B;&#x578B; {string}, {number}, {boolean}&#xFF0C;&#x9996;&#x5B57;&#x6BCD;&#x5FC5;&#x987B;&#x5C0F;&#x5199;&#x3002;</li>
<li><p>&#x6587;&#x4EF6;&#x6CE8;&#x91CA; &#x6587;&#x4EF6;&#x9876;&#x90E8;&#x5FC5;&#x987B;&#x5305;&#x542B;&#x6587;&#x4EF6;&#x6CE8;&#x91CA;&#xFF0C;&#x7528; <code>@file</code> &#x6807;&#x8BC6;&#x6587;&#x4EF6;&#x8BF4;&#x660E;&#x3002;</p>
<pre class="language-"><code class="lang-javascript">     <span class="token comment" spellcheck="true">/**
      * @file Describe the file
      */</span>
</code></pre>
</li>
<li><p>&#x6587;&#x4EF6;&#x6CE8;&#x91CA;&#x4E2D;&#x53EF;&#x4EE5;&#x7528; <code>@author</code> &#x6807;&#x8BC6;&#x5F00;&#x53D1;&#x8005;&#x4FE1;&#x606F;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token comment" spellcheck="true">/**
  * @file Describe the file
  * @author author-name(mail-name@domain.com)
  *         author-name2(mail-name2@domain.com)
  */</span>
</code></pre>
</li>
<li><p>&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x6CE8;&#x91CA; &#x547D;&#x540D;&#x7A7A;&#x95F4;&#x4F7F;&#x7528; <code>@namespace</code> &#x6807;&#x8BC6;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token comment" spellcheck="true">/**
 * @namespace
 */</span>
<span class="token keyword">const</span> util <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
</ol>
<p>11 &#x7C7B;&#x6CE8;&#x91CA; &#x4F7F;&#x7528; <code>@class</code> &#x6807;&#x8BB0;&#x7C7B;&#x6216;&#x6784;&#x9020;&#x51FD;&#x6570;,&#x5BF9;&#x4E8E;&#x4F7F;&#x7528;&#x5BF9;&#x8C61; <code>constructor</code> &#x5C5E;&#x6027;&#x6765;&#x5B9A;&#x4E49;&#x7684;&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>@constructor</code> &#x6765;&#x6807;&#x8BB0;&#x3002;</p>
<pre class="language-"><code>```javascript
    /**
     * &#x63CF;&#x8FF0;
     *
     * @class
     */
    function Developer() {}
```
</code></pre><p>12 &#x4F7F;&#x7528; <code>@extends</code> &#x6807;&#x8BB0;&#x7C7B;&#x7684;&#x7EE7;&#x627F;&#x4FE1;&#x606F;&#x3002;</p>
<pre class="language-"><code class="lang-javascript">    <span class="token comment" spellcheck="true">/**
     * &#x63CF;&#x8FF0;
     *
     * @class
     * @extends Developer
     */</span>
    <span class="token keyword">function</span> <span class="token function">Fronteer</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        Developer<span class="token punctuation">.</span><span class="token function">call</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment" spellcheck="true">// constructor body</span>
    <span class="token punctuation">}</span>
    util<span class="token punctuation">.</span><span class="token function">inherits</span><span class="token punctuation">(</span>Fronteer<span class="token punctuation">,</span> Developer<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<ol>
<li><p>&#x51FD;&#x6570;/&#x65B9;&#x6CD5;&#x6CE8;&#x91CA;&#x5FC5;&#x987B;&#x5305;&#x542B;&#x51FD;&#x6570;&#x8BF4;&#x660E;&#xFF0C;&#x6709;&#x53C2;&#x6570;&#x548C;&#x8FD4;&#x56DE;&#x503C;&#x65F6;&#x5FC5;&#x987B;&#x4F7F;&#x7528;&#x6CE8;&#x91CA;&#x6807;&#x8BC6;&#x3002;</p>
</li>
<li><p>&#x53C2;&#x6570;&#x548C;&#x8FD4;&#x56DE;&#x503C;&#x6CE8;&#x91CA;&#x5FC5;&#x987B;&#x5305;&#x542B;&#x7C7B;&#x578B;&#x4FE1;&#x606F;&#x548C;&#x8BF4;&#x660E;&#x3002;</p>
</li>
<li><p>&#x5F53;&#x51FD;&#x6570;&#x662F;&#x5185;&#x90E8;&#x51FD;&#x6570;&#xFF0C;&#x5916;&#x90E8;&#x4E0D;&#x53EF;&#x8BBF;&#x95EE;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>@inner</code> &#x6807;&#x8BC6;&#x3002;</p>
</li>
</ol>
<pre class="language-"><code class="lang-javascript">    <span class="token comment" spellcheck="true">/**
     * &#x51FD;&#x6570;&#x63CF;&#x8FF0;
     *
     * @param {string} p1 &#x53C2;&#x6570;1&#x7684;&#x8BF4;&#x660E;
     * @param {string} p2 &#x53C2;&#x6570;2&#x7684;&#x8BF4;&#x660E;&#xFF0C;&#x6BD4;&#x8F83;&#x957F;
     *     &#x90A3;&#x5C31;&#x6362;&#x884C;&#x4E86;.
     * @param {number=} p3 &#x53C2;&#x6570;3&#x7684;&#x8BF4;&#x660E;&#xFF08;&#x53EF;&#x9009;&#xFF09;
     * @return {Object} &#x8FD4;&#x56DE;&#x503C;&#x63CF;&#x8FF0;
     */</span>
    <span class="token keyword">function</span> <span class="token function">foo</span><span class="token punctuation">(</span>p1<span class="token punctuation">,</span> p2<span class="token punctuation">,</span> p3<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">let</span> p3 <span class="token operator">=</span> p3 <span class="token operator">||</span> <span class="token number">10</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> <span class="token punctuation">{</span>
            p1<span class="token punctuation">:</span> p1<span class="token punctuation">,</span>
            p2<span class="token punctuation">:</span> p2<span class="token punctuation">,</span>
            p3<span class="token punctuation">:</span> p3
        <span class="token punctuation">}</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre>
<ol>
<li><p>&#x5BF9; Object &#x4E2D;&#x5404;&#x9879;&#x7684;&#x63CF;&#x8FF0;&#xFF0C; &#x5FC5;&#x987B;&#x4F7F;&#x7528; <code>@param</code> &#x6807;&#x8BC6;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token comment" spellcheck="true">/**
 * &#x51FD;&#x6570;&#x63CF;&#x8FF0;
 *
 * @param {Object} option &#x53C2;&#x6570;&#x63CF;&#x8FF0;
 * @param {string} option.url option&#x9879;&#x63CF;&#x8FF0;
 * @param {string=} option.method option&#x9879;&#x63CF;&#x8FF0;&#xFF0C;&#x53EF;&#x9009;&#x53C2;&#x6570;
 */</span>
<span class="token keyword">function</span> <span class="token function">foo</span><span class="token punctuation">(</span>option<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment" spellcheck="true">// TODO</span>
<span class="token punctuation">}</span>
</code></pre>
</li>
<li><p>&#x5FC5;&#x987B;&#x4F7F;&#x7528; <code>@event</code> &#x6807;&#x8BC6;&#x4E8B;&#x4EF6;&#xFF0C;&#x4E8B;&#x4EF6;&#x53C2;&#x6570;&#x7684;&#x6807;&#x8BC6;&#x4E0E;&#x65B9;&#x6CD5;&#x63CF;&#x8FF0;&#x7684;&#x53C2;&#x6570;&#x6807;&#x8BC6;&#x76F8;&#x540C;&#x3002;</p>
<pre class="language-"><code class="lang-javascript">    <span class="token comment" spellcheck="true">/**
     * &#x503C;&#x53D8;&#x66F4;&#x65F6;&#x89E6;&#x53D1;
     *
     * @event
     * @param {Object} e e&#x63CF;&#x8FF0;
     * @param {string} e.before before&#x63CF;&#x8FF0;
     * @param {string} e.after after&#x63CF;&#x8FF0;
     */</span>
    onchange<span class="token punctuation">:</span> <span class="token keyword">function</span> <span class="token punctuation">(</span>e<span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
</code></pre>
</li>
<li><p>&#x5728;&#x4F1A;&#x5E7F;&#x64AD;&#x4E8B;&#x4EF6;&#x7684;&#x51FD;&#x6570;&#x524D;&#x4F7F;&#x7528; <code>@fires</code> &#x6807;&#x8BC6;&#x5E7F;&#x64AD;&#x7684;&#x4E8B;&#x4EF6;&#xFF0C;&#x5728;&#x5E7F;&#x64AD;&#x4E8B;&#x4EF6;&#x4EE3;&#x7801;&#x524D;&#x4F7F;&#x7528; <code>@event</code> &#x6807;&#x8BC6;&#x4E8B;&#x4EF6;&#x3002;</p>
</li>
<li><p>&#x5BF9;&#x4E8E;&#x4E8B;&#x4EF6;&#x5BF9;&#x8C61;&#x7684;&#x6CE8;&#x91CA;&#xFF0C;&#x4F7F;&#x7528; <code>@param</code> &#x6807;&#x8BC6;&#xFF0C;&#x751F;&#x6210;&#x6587;&#x6863;&#x65F6;&#x53EF;&#x8BFB;&#x6027;&#x66F4;&#x597D;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token comment" spellcheck="true">/**
 * &#x70B9;&#x51FB;&#x5904;&#x7406;
 *
 * @fires Select#change
 * @private
 */</span>
Select<span class="token punctuation">.</span>prototype<span class="token punctuation">.</span>clickHandler <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment" spellcheck="true">/**
     * &#x503C;&#x53D8;&#x66F4;&#x65F6;&#x89E6;&#x53D1;
     *
     * @event Select#change
     * @param {Object} e e&#x63CF;&#x8FF0;
     * @param {string} e.before before&#x63CF;&#x8FF0;
     * @param {string} e.after after&#x63CF;&#x8FF0;
     */</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">fire</span><span class="token punctuation">(</span>
        <span class="token string">&apos;change&apos;</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            before<span class="token punctuation">:</span> <span class="token string">&apos;foo&apos;</span><span class="token punctuation">,</span>
            after<span class="token punctuation">:</span> <span class="token string">&apos;bar&apos;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre>
</li>
<li><p>&#x5E38;&#x91CF;&#x5FC5;&#x987B;&#x4F7F;&#x7528; <code>@const</code> &#x6807;&#x8BB0;&#xFF0C;&#x5E76;&#x5305;&#x542B;&#x8BF4;&#x660E;&#x548C;&#x7C7B;&#x578B;&#x4FE1;&#x606F;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"><span class="token comment" spellcheck="true">/**
 * &#x5E38;&#x91CF;&#x8BF4;&#x660E;
 *
 * @const
 * @type {string}
 */</span>
<span class="token keyword">const</span> REQUEST_URL <span class="token operator">=</span> <span class="token string">&apos;myurl.do&apos;</span>
</code></pre>
</li>
<li><p>&#x590D;&#x6742;&#x7C7B;&#x578B;&#x6CE8;&#x91CA; &#x5BF9;&#x4E8E;&#x7C7B;&#x578B;&#x672A;&#x5B9A;&#x4E49;&#x7684;&#x590D;&#x6742;&#x7ED3;&#x6784;&#x7684;&#x6CE8;&#x91CA;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>@typedef</code> &#x6807;&#x8BC6;&#x6765;&#x5B9A;&#x4E49;&#x3002; </p>
<pre class="language-"><code class="lang-javascript"><span class="token comment" spellcheck="true">// `namespaceA~` &#x53EF;&#x4EE5;&#x6362;&#x6210;&#x5176;&#x5B83; namepaths &#x524D;&#x7F00;&#xFF0C;&#x76EE;&#x7684;&#x662F;&#x4E3A;&#x4E86;&#x751F;&#x6210;&#x6587;&#x6863;&#x4E2D;&#x80FD;&#x663E;&#x793A; `@typedef` &#x5B9A;&#x4E49;&#x7684;&#x7C7B;&#x578B;&#x548C;&#x94FE;&#x63A5;&#x3002;</span>
<span class="token comment" spellcheck="true">/**
 * &#x670D;&#x52A1;&#x5668;
 *
 * @typedef {Object} namespaceA~Server
 * @property {string} host &#x4E3B;&#x673A;
 * @property {number} port &#x7AEF;&#x53E3;
 */</span>

<span class="token comment" spellcheck="true">/**
 * &#x670D;&#x52A1;&#x5668;&#x5217;&#x8868;
 *
 * @type {Array.&lt;namespaceA~Server&gt;}
 */</span>
<span class="token keyword">const</span> servers <span class="token operator">=</span> <span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
        host<span class="token punctuation">:</span> <span class="token string">&apos;1.2.3.4&apos;</span><span class="token punctuation">,</span>
        port<span class="token punctuation">:</span> <span class="token number">8080</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token punctuation">{</span>
        host<span class="token punctuation">:</span> <span class="token string">&apos;1.2.3.5&apos;</span><span class="token punctuation">,</span>
        port<span class="token punctuation">:</span> <span class="token number">8081</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre>
</li>
</ol>
<p>22 &#x7EC6;&#x8282;&#x6CE8;&#x91CA; &#x5BF9;&#x4E8E;&#x5185;&#x90E8;&#x5B9E;&#x73B0;&#x3001;&#x4E0D;&#x5BB9;&#x6613;&#x7406;&#x89E3;&#x7684;&#x903B;&#x8F91;&#x8BF4;&#x660E;&#x3001;&#x6458;&#x8981;&#x4FE1;&#x606F;&#x7B49;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x7F16;&#x5199;&#x7EC6;&#x8282;&#x6CE8;&#x91CA;&#x3002;</p>
<blockquote>
<p>&#x7EC6;&#x8282;&#x6CE8;&#x91CA;&#x9075;&#x5FAA;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#x7684;&#x683C;&#x5F0F;&#x3002;&#x8BF4;&#x660E;&#x5FC5;&#x987B;&#x6362;&#x884C;&#x65F6;&#xFF0C;&#x6BCF;&#x884C;&#x662F;&#x4E00;&#x4E2A;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#x7684;&#x8D77;&#x59CB;&#x3002;</p>
</blockquote>
<pre class="language-"><code>```javascript

function foo(p1, p2, opt_p3) {
// &#x8FD9;&#x91CC;&#x5BF9;&#x5177;&#x4F53;&#x5185;&#x90E8;&#x903B;&#x8F91;&#x8FDB;&#x884C;&#x8BF4;&#x660E;
// &#x8BF4;&#x660E;&#x592A;&#x957F;&#x9700;&#x8981;&#x6362;&#x884C;
}

```
</code></pre><p>23 &#x6709;&#x65F6;&#x6211;&#x4EEC;&#x4F1A;&#x4F7F;&#x7528;&#x4E00;&#x4E9B;&#x7279;&#x6B8A;&#x6807;&#x8BB0;&#x8FDB;&#x884C;&#x8BF4;&#x660E;&#x3002;&#x7279;&#x6B8A;&#x6807;&#x8BB0;&#x5FC5;&#x987B;&#x4F7F;&#x7528;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#x7684;&#x5F62;&#x5F0F;&#x3002;&#x4E0B;&#x9762;&#x5217;&#x4E3E;&#x4E86;&#x4E00;&#x4E9B;&#x5E38;&#x7528;&#x6807;&#x8BB0;&#xFF1A; </p>
<pre class="language-"><code>&gt; 1. TODO: &#x6709;&#x529F;&#x80FD;&#x5F85;&#x5B9E;&#x73B0;&#x3002;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x5BF9;&#x5C06;&#x8981;&#x5B9E;&#x73B0;&#x7684;&#x529F;&#x80FD;&#x8FDB;&#x884C;&#x7B80;&#x5355;&#x8BF4;&#x660E;&#x3002;
&gt; 2. FIXME: &#x8BE5;&#x5904;&#x4EE3;&#x7801;&#x8FD0;&#x884C;&#x6CA1;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x53EF;&#x80FD;&#x7531;&#x4E8E;&#x65F6;&#x95F4;&#x8D76;&#x6216;&#x8005;&#x5176;&#x4ED6;&#x539F;&#x56E0;&#xFF0C;&#x9700;&#x8981;&#x4FEE;&#x6B63;&#x3002;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x5BF9;&#x5982;&#x4F55;&#x4FEE;&#x6B63;&#x8FDB;&#x884C;&#x7B80;&#x5355;&#x8BF4;&#x660E;&#x3002;
&gt; 3. HACK: &#x4E3A;&#x4FEE;&#x6B63;&#x67D0;&#x4E9B;&#x95EE;&#x9898;&#x800C;&#x5199;&#x7684;&#x4E0D;&#x592A;&#x597D;&#x6216;&#x8005;&#x4F7F;&#x7528;&#x4E86;&#x67D0;&#x4E9B;&#x8BE1;&#x5F02;&#x624B;&#x6BB5;&#x7684;&#x4EE3;&#x7801;&#x3002;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x5BF9;&#x601D;&#x8DEF;&#x6216;&#x8BE1;&#x5F02;&#x624B;&#x6BB5;&#x8FDB;&#x884C;&#x63CF;&#x8FF0;&#x3002;
&gt; 4. XXX: &#x8BE5;&#x5904;&#x5B58;&#x5728;&#x9677;&#x9631;&#x3002;&#x6B64;&#x65F6;&#x9700;&#x8981;&#x5BF9;&#x9677;&#x9631;&#x8FDB;&#x884C;&#x63CF;&#x8FF0;&#x3002;
</code></pre><h2 id="4-&#x8BED;&#x8A00;&#x7279;&#x6027;"><a name="4-&#x8BED;&#x8A00;&#x7279;&#x6027;" class="plugin-anchor" href="#4-&#x8BED;&#x8A00;&#x7279;&#x6027;"><i class="fa fa-link" aria-hidden="true"></i></a>4 &#x8BED;&#x8A00;&#x7279;&#x6027;</h2>
<ol>
<li>&#x6309;&#x6267;&#x884C;&#x9891;&#x7387;&#x6392;&#x5217;&#x5206;&#x652F;&#x7684;&#x987A;&#x5E8F;&#x3002;<blockquote>
<ol>
<li>&#x9605;&#x8BFB;&#x7684;&#x4EBA;&#x5BB9;&#x6613;&#x627E;&#x5230;&#x6700;&#x5E38;&#x89C1;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x589E;&#x52A0;&#x53EF;&#x8BFB;&#x6027;&#x3002;</li>
<li>&#x63D0;&#x9AD8;&#x6267;&#x884C;&#x6548;&#x7387;&#x3002;</li>
</ol>
</blockquote>
</li>
<li>&#x7C7B;&#x578B;&#x68C0;&#x6D4B;&#x4F18;&#x5148;&#x4F7F;&#x7528; <code>typeof</code>&#x3002;&#x5BF9;&#x8C61;&#x7C7B;&#x578B;&#x68C0;&#x6D4B;&#x4F7F;&#x7528; <code>instanceof</code>&#x3002;<code>null</code> &#x6216; <code>undefined</code> &#x7684;&#x68C0;&#x6D4B;&#x4F7F;&#x7528; <code>== null</code>&#x3002;</li>
<li>&#x5B57;&#x7B26;&#x4E32;&#x5F00;&#x5934;&#x548C;&#x7ED3;&#x675F;&#x4F7F;&#x7528;&#x5355;&#x5F15;&#x53F7; <code>&apos;</code>&#x3002;<blockquote>
<ol>
<li>&#x8F93;&#x5165;&#x5355;&#x5F15;&#x53F7;&#x4E0D;&#x9700;&#x8981;&#x6309;&#x4F4F; shift&#xFF0C;&#x65B9;&#x4FBF;&#x8F93;&#x5165;&#x3002;</li>
<li>&#x5B9E;&#x9645;&#x4F7F;&#x7528;&#x4E2D;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x7ECF;&#x5E38;&#x7528;&#x6765;&#x62FC;&#x63A5; HTML&#x3002;&#x4E3A;&#x65B9;&#x4FBF; HTML &#x4E2D;&#x5305;&#x542B;&#x53CC;&#x5F15;&#x53F7;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x8F6C;&#x4E49;&#x5199;&#x6CD5;&#x3002;</li>
</ol>
</blockquote>
</li>
</ol>
<pre class="language-"><code class="lang-javascript">    <span class="token keyword">let</span> str <span class="token operator">=</span> <span class="token string">&apos;&#x6211;&#x662F;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&apos;</span>
    <span class="token keyword">let</span> html <span class="token operator">=</span> <span class="token string">&apos;&lt;div class=&quot;cls&quot;&gt;&#x62FC;&#x63A5;HTML&#x53EF;&#x4EE5;&#x7701;&#x53BB;&#x53CC;&#x5F15;&#x53F7;&#x8F6C;&#x4E49;&lt;/div&gt;&apos;</span>
</code></pre>
<ol>
<li>&#x4E0D;&#x56E0;&#x4E3A;&#x6027;&#x80FD;&#x7684;&#x539F;&#x56E0;&#x81EA;&#x5DF1;&#x5B9E;&#x73B0;&#x6570;&#x7EC4;&#x6392;&#x5E8F;&#x529F;&#x80FD;&#xFF0C;&#x5C3D;&#x91CF;&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x7684; <code>sort</code> &#x65B9;&#x6CD5;&#x3002;</li>
<li>&#x6E05;&#x7A7A;&#x6570;&#x7EC4;&#x4F7F;&#x7528; <code>.length = 0</code>&#x3002;</li>
<li>&#x53C2;&#x6570;&#x8BBE;&#x8BA1; &#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x63A7;&#x5236;&#x5728; <code>6</code> &#x4E2A;&#x4EE5;&#x5185;&#x3002;</li>
<li><p>&#x901A;&#x8FC7; <code>options</code> &#x53C2;&#x6570;&#x4F20;&#x9012;&#x975E;&#x6570;&#x636E;&#x8F93;&#x5165;&#x578B;&#x53C2;&#x6570;&#x3002;</p>
<pre class="language-"><code class="lang-javascript"> <span class="token comment" spellcheck="true">/**
  * &#x79FB;&#x9664;&#x67D0;&#x4E2A;&#x5143;&#x7D20;
  *
  * @param {Node} element &#x9700;&#x8981;&#x79FB;&#x9664;&#x7684;&#x5143;&#x7D20;
  * @param {Object} options &#x76F8;&#x5173;&#x7684;&#x903B;&#x8F91;&#x914D;&#x7F6E;
  * @param {boolean} options.removeEventListeners &#x662F;&#x5426;&#x540C;&#x65F6;&#x5C06;&#x6240;&#x6709;&#x6CE8;&#x518C;&#x5728;&#x5143;&#x7D20;&#x4E0A;&#x7684;&#x4E8B;&#x4EF6;&#x79FB;&#x9664;
  */</span>
 <span class="token keyword">function</span> <span class="token function">removeElement</span><span class="token punctuation">(</span>element<span class="token punctuation">,</span> options<span class="token punctuation">)</span> <span class="token punctuation">{</span>
     element<span class="token punctuation">.</span>parent<span class="token punctuation">.</span><span class="token function">removeChild</span><span class="token punctuation">(</span>element<span class="token punctuation">)</span><span class="token punctuation">;</span>
     <span class="token keyword">if</span> <span class="token punctuation">(</span>options<span class="token punctuation">.</span>removeEventListeners<span class="token punctuation">)</span> <span class="token punctuation">{</span>
         element<span class="token punctuation">.</span><span class="token function">clearEventListeners</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
     <span class="token punctuation">}</span>
 <span class="token punctuation">}</span>
</code></pre>
</li>
<li>&#x5728;&#x9002;&#x5F53;&#x7684;&#x65F6;&#x5019;&#x5C06;&#x95ED;&#x5305;&#x5185;&#x5927;&#x5BF9;&#x8C61;&#x7F6E;&#x4E3A; <code>null</code>&#x3002;</li>
<li>&#x81EA;&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684; <code>&#x4E8B;&#x4EF6;&#x540D;</code> &#x5FC5;&#x987B;&#x5168;&#x5C0F;&#x5199;&#x3002;</li>
<li>&#x81EA;&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x53EA;&#x80FD;&#x6709;&#x4E00;&#x4E2A; <code>event</code> &#x53C2;&#x6570;&#x3002;&#x5982;&#x679C;&#x4E8B;&#x4EF6;&#x9700;&#x8981;&#x4F20;&#x9012;&#x8F83;&#x591A;&#x4FE1;&#x606F;&#xFF0C;&#x5E94;&#x4ED4;&#x7EC6;&#x8BBE;&#x8BA1;&#x4E8B;&#x4EF6;&#x5BF9;&#x8C61;&#x3002;<blockquote>
<ol>
<li>&#x987A;&#x5E8F;&#x65E0;&#x5173;&#xFF0C;&#x907F;&#x514D;&#x4E8B;&#x4EF6;&#x76D1;&#x542C;&#x8005;&#x9700;&#x8981;&#x8BB0;&#x5FC6;&#x53C2;&#x6570;&#x987A;&#x5E8F;&#x3002;</li>
<li>&#x6BCF;&#x4E2A;&#x4E8B;&#x4EF6;&#x4FE1;&#x606F;&#x90FD;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x9700;&#x8981;&#x63D0;&#x4F9B;&#x6216;&#x8005;&#x4E0D;&#x63D0;&#x4F9B;&#xFF0C;&#x66F4;&#x81EA;&#x7531;&#x3002;</li>
<li>&#x6269;&#x5C55;&#x65B9;&#x4FBF;&#xFF0C;&#x672A;&#x6765;&#x6DFB;&#x52A0;&#x4E8B;&#x4EF6;&#x4FE1;&#x606F;&#x65F6;&#xFF0C;&#x65E0;&#x9700;&#x8003;&#x8651;&#x4F1A;&#x7834;&#x574F;&#x76D1;&#x542C;&#x5668;&#x53C2;&#x6570;&#x5F62;&#x5F0F;&#x800C;&#x65E0;&#x6CD5;&#x5411;&#x540E;&#x517C;&#x5BB9;&#x3002;</li>
</ol>
</blockquote>
</li>
</ol>
<p>11 &#x8BBE;&#x8BA1;&#x81EA;&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x65F6;&#xFF0C;&#x5E94;&#x8003;&#x8651;&#x7981;&#x6B62;&#x9ED8;&#x8BA4;&#x884C;&#x4E3A;&#x3002;</p>
<blockquote>
<ol>
<li>&#x4E8B;&#x4EF6;&#x76D1;&#x542C;&#x51FD;&#x6570;&#x4E2D; return false&#x3002;</li>
<li>&#x4E8B;&#x4EF6;&#x5BF9;&#x8C61;&#x4E2D;&#x5305;&#x542B;&#x7981;&#x6B62;&#x9ED8;&#x8BA4;&#x884C;&#x4E3A;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x5982; preventDefault&#x3002;</li>
</ol>
</blockquote>
<ol>
<li>&#x51CF;&#x5C11; <code>delete</code> &#x7684;&#x4F7F;&#x7528;&#x3002;<blockquote>
<p>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x7279;&#x522B;&#x7684;&#x9700;&#x6C42;&#xFF0C;&#x51CF;&#x5C11;&#x6216;&#x907F;&#x514D;&#x4F7F;&#x7528;<code>delete</code>&#x3002;<code>delete</code>&#x7684;&#x4F7F;&#x7528;&#x4F1A;&#x7834;&#x574F;&#x90E8;&#x5206; JavaScript &#x5F15;&#x64CE;&#x7684;&#x6027;&#x80FD;&#x4F18;&#x5316;&#x3002;</p>
</blockquote>
</li>
</ol>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; doc.ickeep.com 2017 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2017-03-10 20:30:56
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="2.CSS.html" class="navigation navigation-prev " aria-label="Previous page: 2.CSS">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="4.ESlint检测规则说明.html" class="navigation navigation-next " aria-label="Next page: 4.ESlint 检测规则说明">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.JavaScript","level":"2.3","depth":1,"next":{"title":"4.ESlint 检测规则说明","level":"2.4","depth":1,"path":"2.前端规范/4.ESlint检测规则说明.md","ref":"2.前端规范/4.ESlint检测规则说明.md","articles":[]},"previous":{"title":"2.CSS","level":"2.2","depth":1,"path":"2.前端规范/2.CSS.md","ref":"2.前端规范/2.CSS.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","prism","-highlight","search-plus","tbfed-pagefooter","expandable-chapters-small","anchors","edit-link","diy-introduction","sitemap-general","livereload"],"root":"./docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy doc.ickeep.com 2017","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"introduction-text":"开发说明","prism":{},"livereload":{},"sitemap-general":{"prefix":"https://doc.ickeep.com"},"fontsettings":{"theme":"white","family":"sans","size":2},"fontSettings":{"theme":"night","family":"sans","size":2},"diy-introduction":{},"favicon":{"shortcut":"/assets/img/favicon.ico","bookmark":"/assets/img/favicon.ico","appleTouch":"/assets/img/apple-touch-icon.png","appleTouchMore":{"120x120":"/assets/img/apple-touch-icon-120x120.png","180x180":"/assets/img/apple-touch-icon-180x180.png"}},"expandable-chapters-small":{},"sharing":{"facebook":false,"twitter":false,"google":false,"weibo":true,"instapaper":false,"vk":false,"all":["facebook","google","twitter","instapaper","instapaper"]},"edit-link":{"label":"编辑此页","base":"https://git.oschina.net/ickeep/dev-doc.git/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"search-plus":{}},"theme":"default","author":"i@ickeep.com","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.MD","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"邦德前端开发","language":"zh-hans","links":{"sidebar":{"邦德官网":"http://2017hcb.bond520.com/pc/index.html"}},"gitbook":"*","description":"邦德前端开发文档"},"file":{"path":"2.前端规范/3.JavaScript.md","mtime":"2017-03-10T12:30:56.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-03-10T13:25:56.104Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

